package com.ruifu.pls.entity;
import com.ruifu.pls.model.InventoryForchWithEnter.GLinInventoryProducts;

import javax.persistence.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * ********************************************************
 * * @desc  ：
 * * @author  ${user}
 * * @date    ${date}
 * * @version v1.0
 * * ${tags}
 * *******************************************************
 */
@Entity
@Table(name = "inv_lot_loc_id")
@IdClass(InvLotLocIdId.class)
public class InvLotLocId implements java.io.Serializable{


        private String customerid;//
        private String sku;//
        private Double qty;//
        private Double qtyonhold;//
        private Date edittime;
        private String ALTERNATE_SKU5;//
        private String WAREHOUSEID;//
        private String LOTATT08;//
        private String LOTATT01;//
        private String LOTATT02;//
        private String LOTATT04;//生产批号
        private String LOTATT05;//
        private String lotnum;
        private String locationid;
        private String traceid;



    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public GLinInventoryProducts gLinInventoryProducts = new GLinInventoryProducts();



        /** default constructor */
        public InvLotLocId() {
        }

        /** minimal constructor */
        public InvLotLocId(InvLotLocId id, String customerid, String sku,
                           Double qtyrpin, Double qtyrpout, Date addtime, Date edittime,
                           Double netweight, Double grossweight, Double cubic, Double price,
                           Double qtypa) {

            this.customerid = customerid;
            this.sku = sku;

            this.edittime = edittime;

        }

        /** full constructor */
        public InvLotLocId(InvLotLocId id, String customerid, String sku,
                           Double qty, Double qtyallocated, Double qtyrpin, Double qtyrpout,
                           Double qtymvin, Double qtymvout, Double qtyonhold, Date addtime,
                           String addwho, Date edittime, String editwho, Double netweight,
                           Double grossweight, Double cubic, Double price,
                           BigDecimal onholdlocker, String lpn, Double qtypa,
                           Date lastmaintenancedate) {
            //this.id = id;
            this.customerid = customerid;
            this.sku = sku;
            this.qty = qty;

            this.qtyonhold = qtyonhold;

            this.edittime = edittime;

        }
        @Id
        @Column(name = "LOTNUM", nullable = false, length = 10)
        public String getLotnum() {
            return this.lotnum;
        }

        public void setLotnum(String lotnum) {
            this.lotnum = lotnum;
        }
        @Id
        @Column(name = "LOCATIONID", nullable = false, length = 60)
        public String getLocationid() {
            return this.locationid;
        }

        public void setLocationid(String locationid) {
            this.locationid = locationid;
        }
        @Id
        @Column(name = "TRACEID", nullable = false, length = 30)
        public String getTraceid() {
            return this.traceid;
        }

        public void setTraceid(String traceid) {
            this.traceid = traceid;
        }

   // public InvLotLocId getId() {
  /* @NotFound
    public String getEdiTNewTime() {
        return ediTNewTime;
    }
    @NotFound
    public void setEdiTNewTime(String ediTNewTime) {
        this.ediTNewTime = ediTNewTime;
        if(ediTNewTime == null)
        {
            this.gLinInventoryProducts.setUpdateTime(dateFormat.format(new Date()));
        }
        else
        {
            this.gLinInventoryProducts.setUpdateTime(dateFormat.format(ediTNewTime));
        }
    }

    public String getQtyNew() {
        return qtyNew;
    }

    public void setQtyNew(String qtyNew) {
        this.qtyNew = qtyNew;
        this.gLinInventoryProducts.setActualQty(String.valueOf(getQty()));
    }*/
    //  return id;
   // }

  //  public void setId(InvLotLocId id) {
    //    this.id = id;
    //}
  public String getALTERNATE_SKU5() {
      return ALTERNATE_SKU5;
  }

    public void setALTERNATE_SKU5(String ALTERNATE_SKU5) {
        this.ALTERNATE_SKU5 = ALTERNATE_SKU5;
        this.gLinInventoryProducts.setItemCode(getALTERNATE_SKU5());

    }

    public String getWAREHOUSEID() {
        return WAREHOUSEID;
    }

    public void setWAREHOUSEID(String WAREHOUSEID) {
        this.WAREHOUSEID = WAREHOUSEID;
        this.gLinInventoryProducts.setWarehouseCode(getWAREHOUSEID());

    }
    public String getLOTATT01() {
        return LOTATT01;
    }

    public void setLOTATT01(String LOTATT01) {
        this.LOTATT01 = LOTATT01;
        //System.out.print(LOTATT01+"---------------------------------");
        if(LOTATT01 == null)
        {
            this.gLinInventoryProducts.setProductDate(dateFormat.format(new Date()));
        }
        else
        {
            this.gLinInventoryProducts.setProductDate(LOTATT01);
        }
    }

    public String getLOTATT02() {
        return LOTATT02;
    }

    public void setLOTATT02(String LOTATT02) {
        this.LOTATT02 = LOTATT02;
        if(LOTATT02 == null)
        {
            this.gLinInventoryProducts.setExpireDate(dateFormat.format(new Date()));
        }
        else
        {
            this.gLinInventoryProducts.setExpireDate(LOTATT02);
        }
    }

    public String getLOTATT04() {
        return LOTATT04;
    }

    public void setLOTATT04(String LOTATT04) {
        this.LOTATT04 = LOTATT04;
        this.gLinInventoryProducts.setProduceCode(getLOTATT04());
    }

    public String getLOTATT05() {
        return LOTATT05;
    }

    public void setLOTATT05(String LOTATT05) {
        this.LOTATT05 = LOTATT05;
        this.gLinInventoryProducts.setBatchCode(getLOTATT05());
    }

    public String getLOTATT08() {
        return LOTATT08;
    }

    public void setLOTATT08(String LOTATT08) {
        this.LOTATT08 = LOTATT08;
        this.gLinInventoryProducts.setInventoryType(getLOTATT08());

    }

    @Column(name = "CUSTOMERID", nullable = false, length = 30)
        public String getCustomerid() {
            return this.customerid;
        }

        public void setCustomerid(String customerid) {
            this.customerid = customerid;
            this.gLinInventoryProducts.setOwnerCode(getCustomerid());
        }

        @Column(name = "SKU", nullable = false, length = 50)
        public String getSku() {
            return this.sku;
        }

        public void setSku(String sku) {
            this.sku = sku;
        }

        @Column(name = "QTY", precision = 18, scale = 8)
        public Double getQty() {
            return this.qty;
        }

        public void setQty(Double qty) {
            this.qty = qty;
            this.gLinInventoryProducts.setActualQty(String.valueOf(qty));

        }





        @Column(name = "QTYONHOLD", precision = 23, scale = 8)
        public Double getQtyonhold() {
            return this.qtyonhold;
        }

        public void setQtyonhold(Double qtyonhold) {
            this.qtyonhold = qtyonhold;
        }



        @Temporal(TemporalType.DATE)
        @Column(name = "EDITTIME", nullable = false, length = 7)
        public Date getEdittime() {
            return this.edittime;
        }

        public void setEdittime(Date edittime) {
            this.edittime = edittime;
            if(LOTATT02 == null)
            {
                this.gLinInventoryProducts.setUpdateTime(dateFormat.format(new Date()));
            }
            else
            {
                this.gLinInventoryProducts.setUpdateTime(dateFormat.format(getEdittime()));
            }

        }


    }